00001
00010 #ifndef ZNP_INTERFACE_H
00011 #define ZNP_INTERFACE_H
00012
00013 #include "../ZNP/znp_commands.h"
00014
00015
00016 unsigned char* znpInit();
00017 unsigned char* znpReset();
00018 char* getResetReason(unsigned char reason);
00019 unsigned char* getVersion();
00020 unsigned int getRandom();
00021 signed int waitForMessage(unsigned int messageType, unsigned int timeoutMs, unsigned int intervalMs);
00022
00023
00024 void setZigbeeDeviceType(unsigned char deviceType);
00025 void setPanId(unsigned int panId);
00026 void setChannel(unsigned long channelMask);
00027 void setStartupOptions(unsigned char option);
00028 void setCallbacks(unsigned char cb);
00029 void setSecurityMode(unsigned char securityMode);
00030 void setSecurityKey(unsigned char* key);
00031 unsigned char* getConfigurationParameter(unsigned char configId);
00032 void getNetworkConfigurationParameters();
00033
00034
00035 unsigned char* getDeviceInformationProperty(unsigned char dip);
00036 unsigned char* getMacAddress();
00037 unsigned char getDeviceState();
00038 char* getDeviceStateName(unsigned char state);
00039 void getDeviceInformation();
00040
00041
00042 unsigned char getNvItemSize(unsigned char nvItem);
00043 void writeNvItem(unsigned char nvItem, unsigned char* data);
00044 unsigned char* readNvItem(unsigned char nvItem);
00045
00046
00047 unsigned char sysGpio(unsigned char operation, unsigned char value);
00048
00049
00050
00051 #define COORDINATOR 0x00
00052 #define ROUTER 0x01
00053 #define END_DEVICE 0x02
00054
00055
00056 #define DIP_STATE 0x00
00057 #define DIP_MAC_ADDRESS 0x01
00058 #define DIP_SHORT_ADDRESS 0x02
00059 #define DIP_PARENT_SHORT_ADDRESS 0x03
00060 #define DIP_PARENT_MAC_ADDRESS 0x04
00061 #define DIP_CHANNEL 0x05
00062 #define DIP_PANID 0x06
00063 #define DIP_EXTENDED_PANID 0x07
00064 #define MAX_DEVICE_INFORMATION_PROPERTY 0x07
00065
00066 #define DIP_MAC_ADDRESS_LENGTH 8
00067 #define DIP_SHORT_ADDRESS_LENGTH 2
00068 #define DIP_PARENT_SHORT_ADDRESS_LENGTH 2
00069 #define DIP_PARENT_MAC_ADDRESS_LENGTH 8
00070 #define DIP_CHANNEL_LENGTH 1
00071 #define DIP_PANID_LENGTH 2
00072 #define DIP_EXTENDED_PANID_LENGTH 8
00073
00074
00075 #define ZCD_NV_STARTUP_OPTION 0x03
00076 #define ZCD_NV_LOGICAL_TYPE 0x87
00077 #define ZCD_NV_ZDO_DIRECT_CB 0x8F
00078
00079 #define ZCD_NV_PRECFGKEY 0x62
00080 #define ZCD_NV_PRECFGKEY_LEN 16
00081 #define ZCD_NV_PRECFGKEYS_ENABLE 0x63
00082 #define ZCD_NV_PRECFGKEYS_ENABLE_LEN 1
00083 #define ZCD_NV_SECURITY_MODE 0x64
00084 #define ZCD_NV_SECURITY_MODE_LEN 1
00085
00086
00087 #define ZCD_NV_PANID 0x83
00088 #define ZCD_NV_PANID_LEN 2
00089 #define ZCD_NV_CHANLIST 0x84
00090 #define ZCD_NV_CHANLIST_LEN 4
00091
00092
00093 #define STARTOPT_CLEAR_CONFIG 0x01
00094 #define STARTOPT_CLEAR_STATE 0x02
00095 #define STARTOPT_AUTO 0x04
00096
00097
00098 #define MAC_ACK 0x00 //Require Acknowledgement from next device on route
00099 #define AF_APS_ACK 0x10 //Require Acknowledgement from final destination (if using AFZDO)
00100 #define SAPI_APS_ACK 0x01 //Require Acknowledgement from final destination (if using Simple API)
00101 #define DEFAULT_RADIUS 0x0F //Maximum number of hops to get to destination
00102 #define MAXIMUM_PAYLOAD_LENGTH 66 //84 bytes without security, 66 bytes with security
00103 #define ALL_DEVICES 0xFFFF
00104 #define ALL_ROUTERS_AND_COORDINATORS 0xFFFC
00105
00106
00107 #define SECURITY_MODE_OFF 0
00108 #define SECURITY_MODE_PRECONFIGURED_KEYS 1
00109 #define SECURITY_MODE_COORD_DIST_KEYS 2
00110
00111
00112 #define CALLBACKS_DISABLED 0
00113 #define CALLBACKS_ENABLED 1
00114
00115
00116 #define NO_TIMEOUT 0xFF
00117
00118
00119 #define ANY_PAN 0xFFFF
00120
00121
00122
00123
00124 #define DEV_HOLD 0
00125 #define DEV_INIT 1
00126 #define DEV_NWK_DISC 2
00127 #define DEV_NWK_JOINING 3
00128 #define DEV_NWK_REJOIN 4
00129 #define DEV_END_DEVICE_UNAUTH 5
00130 #define DEV_END_DEVICE 6
00131 #define DEV_ROUTER 7
00132 #define DEV_COORD_STARTING 8
00133 #define DEV_ZB_COORD 9
00134 #define DEV_NWK_ORPHAN 10
00135
00136
00137
00138 #define ANY_CHANNEL 0x07FFF800
00139 #define MIN_CHANNEL 0x00000800
00140 #define MAX_CHANNEL ANY_CHANNEL
00141
00142
00143
00144
00145
00146 #define GPIO_SET_DIRECTION 0x00
00147 #define GPIO_SET_INPUT_MODE 0x01
00148 #define GPIO_SET 0x02
00149 #define GPIO_CLEAR 0x03
00150 #define GPIO_TOGGLE 0x04
00151 #define GPIO_READ 0x05
00152
00153 #define ALL_GPIO_PINS 0x0F //GPIO 0-3
00154
00155
00156 #define GPIO_INPUT_MODE_ALL_PULL_DOWNS 0xF0
00157 #define GPIO_INPUT_MODE_ALL_PULL_UPS 0x00
00158 #define GPIO_INPUT_MODE_ALL_TRI_STATE 0x0F
00159 #define GPIO_DIRECTION_ALL_INPUTS 0x00
00160
00161 #define MIN_NV_ITEM 1
00162 #define MAX_NV_ITEM 6
00163
00164 #define NV_ITEM_1 0x0F01
00165 #define NV_ITEM_2 0x0F02
00166 #define NV_ITEM_3 0x0F03
00167 #define NV_ITEM_4 0x0F04
00168
00169 #define NV_ITEM_5 0x0F05
00170 #define NV_ITEM_6 0x0F06
00171
00172 #endif